Skip to content

Conversation

@ephraimbuddy
Copy link
Contributor

@ephraimbuddy ephraimbuddy commented Aug 14, 2025

As part of the ongoing server/client separation,
this commit moves out some exceptions to the Task sdk.

@ephraimbuddy ephraimbuddy force-pushed the exception-separation branch 3 times, most recently from f4a380e to 7a4587c Compare August 15, 2025 07:48
@ephraimbuddy ephraimbuddy marked this pull request as ready for review August 15, 2025 07:51
@ephraimbuddy ephraimbuddy force-pushed the exception-separation branch 7 times, most recently from 90180cf to 59d7f90 Compare August 24, 2025 18:17
@ephraimbuddy ephraimbuddy merged commit c52606a into apache:main Nov 26, 2025
118 checks passed
@ephraimbuddy ephraimbuddy deleted the exception-separation branch November 26, 2025 12:24
@amoghrajesh
Copy link
Contributor

🥳

@potiuk
Copy link
Member

potiuk commented Nov 28, 2025

nice!

Copilot AI pushed a commit to jason810496/airflow that referenced this pull request Dec 5, 2025
* Move out some exceptions to TaskSDK

As part of the ongoing server/client separation,
this commit moves out some exceptions to the Task sdk.

The AirflowException usage in task sdk has been changed to
RuntimeError.
Also, the TaskNotFound exception is still duplicated due to
the many usages in core API and SDK.

Rename back RuntimeError to AirflowException

expose TaskNotFound import from exceptions

completely separate sdk imports

fix conflicts

Keep base AirflowException only in sdk

import some exception from sdk into core exceptions

add to be deprecated function to handle TaskNotFound and ParamValidationError

catch some import error in airflow.exceptions and redefine the exceptions

Core should not raise exceptions

Move some exceptions to deprecated

Raise RuntimeError instead of AirflowException in SDK

Rename AirflowException in SDK to AirflowSDKException

Update tests

Remove AirflowNotFound in sdk exceptions

Catch import errors for exceptions in example dags

remove get_task redefine

Import AirflowSensorTimeout properly and Remove airflowNotFoundException import from sdk

Remove AirflowFailException in core

Import AirflowException from core with a compat shim

Fix import

Use the sdk AirflowException in core and fix other exceptions

raise ValueError in sparkhook

* fixup! Move out some exceptions to TaskSDK

* Fix provider RuntimeError change and fix for shared package modulenotfounderror

* fixup! Fix provider RuntimeError change and fix for shared package modulenotfounderror

* Fix sdk connection to catch RuntimeError instead of AirflowException

* Use random str at task end to prevent duplicate task_id error so that the real error would raise

* fixup! Use random str at task end to prevent duplicate task_id error so that the real error would raise

* Use RuntimeError instead of AirflowNotFoundException for connections

* fixup! fixup! Use RuntimeError instead of AirflowNotFoundException for connections

* import tasktimeout properly

* move TaskNotFound to sdk

* Apply suggestion from @ephraimbuddy

* Retain AirflowNotFoundException

* AirflowException now inherits from RuntimeError, update provider changes

* fixup! AirflowException now inherits from RuntimeError, update provider changes

* Now that AirflowException inherits from Runtime, remove change of AirflowException to RuntimeError

* Fix imports and exception use in providers

* Explicitly cover for shared packages in exception

* Fix ruff broadexception

* fix mypy issue

* remove unintended file addition

* Remove left over cleanup

* Return exception to AirflowException

* Use import_string

* Fix static checks

* Revert subclassing AirflowException from Runtime

* Fix providers importing deprecated exceptions to use compat SDK

* fixup! Fix providers importing deprecated exceptions to use compat SDK

* Use ModuleNotFoundError in exception if airflow.sdk is not installed(usually caused by _AIRFLOW__AS_LIBRARY

* Fix Airflow 2 compat

* Use ValueError instead of RuntimeError were appropriate

* Update compat to have only the imports used in provider

* Update example dag import and fix mypy error

* fix conflict

* Add news fragment item

* fixup! Add news fragment item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants